<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Report Detail</title>
		<link href="../css/default.css" rel="stylesheet" type="text/css" />
		<link href="../css/tabs.css" rel="stylesheet" type="text/css" />
		<link href="../css/structuredreport.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jsx.js"></script>
		<script type="text/javascript" src="../js/jsml.js"></script>
		<script type="text/javascript" src="../js/ui.js"></script>
		<script type="text/javascript" src="../js/ris.js"></script>
		<script type="text/javascript" src="../js/SR.js"></script>
		<script type="text/javascript" src="../js/preview.js"></script>
		<script type="text/javascript" src="../js/layout.js"></script>
		<script type="text/javascript" src="../js/tabs.js"></script>
		<script type="text/javascript" src="../js/structuredreportsummary.js"></script>
		<script type="text/javascript" >
			var errorProvider = new ErrorProvider();

			function onBodyLoad()
			{
				if(!Ris)
					return;

				var reportRef = Ris.getHealthcareContext();
				if (reportRef == null)
				{
					Field.setValue($("myForm"), "");
					return;
				}

				Ris.getPatientDataService().getDataAsync(CreateRequest(reportRef), OnPatientDataLoaded);
			}

			function CreateRequest(reportRef)
			{
				return {
					// only request the report detail if there is a report     
					GetReportDetailRequest:{ ReportRef: reportRef }
				};
			}

			function OnPatientDataLoaded(data)
			{
				if (data == null || data.length == 0)
				{
					Field.setValue($("myForm"), "");
					return;
				}

				var reportDetail = data.GetReportDetailResponse ? data.GetReportDetailResponse.Report : null;
				Preview.ReportPreview.create($("reportSection"), reportDetail);
			}
		</script>
	</head>
	<body onload="javascript: onBodyLoad()">
		<form id="myForm">
			<div id="reportSection"></div>
		</form>
	</body>
</html>